package java44th.group.bean.wx.vo.goods;

import com.github.pagehelper.PageInfo;
import java44th.group.bean.common.CommonData;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @projectName: project-second
 * @package: java44th.group.bean.wx.vo.goods
 * @className: WxGoodsRelatedVO
 * @author: 杨浩祥
 * @description: TODO
 * @date: 2022/10/15 17:20
 * @version: 1.0
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class WxGoodsRelatedVO implements Serializable {


    /**
     * total : 4
     * pages : 1
     * limit : 6
     * page : 1
     * list : [{"id":1181090,"name":"海尔电视","brief":"实在是好","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/a7xii1nxgmhodsswbqi7.jpg","isNew":true,"isHot":true,"counterPrice":5000,"retailPrice":0},{"id":1086015,"name":"北欧极简直杆台灯","brief":"北欧色彩，极简线条","picUrl":"http://yanxuan.nosdn.127.net/d5c2ecfe0fb00cdd8b829975bab21a31.png","isNew":false,"isHot":false,"counterPrice":269,"retailPrice":249},{"id":1064021,"name":"清欢日式可调节台灯","brief":"木铁结合，全体可调节","picUrl":"http://yanxuan.nosdn.127.net/c83a3881704094ddd3970099ca77d115.png","isNew":false,"isHot":false,"counterPrice":219,"retailPrice":199},{"id":1064022,"name":"清欢日式可调节落地灯","brief":"便易调节，风格百搭","picUrl":"http://yanxuan.nosdn.127.net/a9c155e26d09e3c92b623f0472ed674a.png","isNew":false,"isHot":false,"counterPrice":319,"retailPrice":299}]
     */

    private Integer total;
    private Integer pages;
    private Integer limit;
    private Integer page;
    private List<GoodsPartListVO> list;

    public static  WxGoodsRelatedVO data(PageInfo pageInfo) {
        int pages = pageInfo.getPages();
        int pageNum = pageInfo.getPageNum();
        int pageSize = pageInfo.getPageSize();
        int total = (int) pageInfo.getTotal();
        List list = pageInfo.getList();
        return new WxGoodsRelatedVO(total, pages, pageSize, pageNum, list);
    }
}
